package com.baor.controller;

import com.baor.domain.CouponUserVo;
import com.baor.domain.UserVo;
import com.baor.service.ProgramService;
import com.baor.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/program")
public class ProgramController {
    @Autowired
    private ProgramService programService;
    @RequestMapping("/couponList")
    public AjaxResult<?> couponList(@RequestBody Map<String,Object> params){
        return this.programService.list(params);
    }
    // 用户领取优惠券在关联表中插入
    @RequestMapping("/addCouponUser")
    public AjaxResult<?> addCouponUser(@RequestBody CouponUserVo vo){
        return this.programService.addCouponUser(vo);
    }
    // 完成订单时候修改用户优惠券状态
    @RequestMapping("/login")
    public AjaxResult<?> login(@RequestBody UserVo vo){
     return this.programService.login(vo);
    }
    @RequestMapping("/enroll")
    public AjaxResult<?> enroll(@RequestBody UserVo userVo){
        return this.programService.enroll(userVo);
    }
}
